package com.zfy.cmsservice.service.impl;

import com.zfy.cmsservice.entity.Exams;
import com.zfy.cmsservice.entity.vo.ExamsVo;
import com.zfy.cmsservice.mapper.ExamsMapper;
import com.zfy.cmsservice.service.ExamsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zfy.commonutils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 考试表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2023-12-09
 */
@Service
public class ExamsServiceImpl extends ServiceImpl<ExamsMapper, Exams> implements ExamsService {
    @Autowired
    private ExamsMapper examsMapper;
    @Override
    public R pageExams(long page, long size, String begin, String end) {
        page = (page-1)*size;
        List<ExamsVo> records = examsMapper.pageExams(page,size,begin,end);
        int total = examsMapper.pageExamsTotal(page,size,begin,end);
        return R.ok().data("total", total).data("content", records);
    }

    @Override
    public List<Exams> findAllExams() {
        return examsMapper.findAllExams();
    }
}
